﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace AutoCs.Screen
{
    public class ScreenManager
    {
        public static void HighLightWindow(IntPtr hWnd)  //高亮其实就是用Pen绘制一个和窗口大小一样的红色框
        {
            const float penWidth = 3;
            Rectangle rc = new Rectangle();
            CsSharpApi.GetWindowRect(hWnd, out rc);
            IntPtr hDC = CsSharpApi.GetWindowDC(hWnd);
            if (hDC != IntPtr.Zero)
            {
                using (Pen pen = new Pen(Color.Red, penWidth))
                {
                    using (Graphics g = Graphics.FromHdc(hDC))
                    {
                        Font font = new Font("Courer New", 9, FontStyle.Bold);
                        g.DrawRectangle(pen, 0, 0, rc.Right - rc.Left - (int)penWidth, rc.Bottom - rc.Top - (int)penWidth);
                        g.DrawString("BIC Tech <SPY>", font, Brushes.Red, 5, 5);
                    }
                }
            }
            CsSharpApi.ReleaseDC(hWnd,hDC);
        }
    }
}
